package edu.sctu.practice.class02.shilaihong.assign03.text1;

/**
 * Created by admin on 2015/10/22.
 */
public class Rectangle extends GeometricObject {
    protected double width;
    protected double length;
    double perimeter;
    double area;

    public Rectangle() {
        this(2.0, 2.0, "blue");
    }

    public Rectangle(String color, double length) {
       super("color");
        this.length = length;
    }

    public Rectangle(double width, double length, String color) {
        this.width = width;
        this.length =length;
    }

    public double getWidth() {
        return width;
    }

    public void setWidth(){
        this.width = width;
    }

    public double getLength(){
        return length;
    }

    public void setLength(){
        this.length =length;
    }

    @Override
    public double findArea() {
        area=length*width;
        return area;
    }

    @Override
    public double findPerimeter() {
        perimeter=(width+length)*2;
        return perimeter;
    }

    public boolean equals(Rectangle rectangle){
        return (width==rectangle.getWidth())&&(length==rectangle.getLength());
    }
}
